﻿<UserControl x:Class="RL.ucFullRouteInfo"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="548" d:DesignWidth="579" xmlns:my="clr-namespace:RL" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <CollectionViewSource x:Key="sourceSchedule" />
        <CollectionViewSource x:Key="sourceInfo" />
        <CollectionViewSource x:Key="sourceRoutes" />
        <DataTemplate x:Key="cellDel">
            <CheckBox IsEnabled="False" IsChecked="{Binding Path=del}"/>
        </DataTemplate>
        <DataTemplate x:Key="cellRoute">
            <!--<ComboBox ItemsSource="{Binding Source={StaticResource sourceRoutes}}" DisplayMemberPath="number" SelectedValue="{Binding Path=RouteTable}" SelectedValuePath="id_route"/> -->
            <ComboBox ItemsSource="{Binding Source={StaticResource sourceRoutes}}" DisplayMemberPath="number" SelectedValuePath="id" SelectedItem="{Binding Path=Routes, Mode=TwoWay}" IsSynchronizedWithCurrentItem="False"/>
        </DataTemplate>

        <DataTemplate  x:Key="cellBusstop">
            <TextBox Text="{Binding Path=name_busstop}" />
        </DataTemplate>
        <DataTemplate x:Key="cellArrive">
            <TextBox Text="{Binding Path=time_arrive}" />
        </DataTemplate>
        <DataTemplate x:Key="cellDeparture">
            <TextBox Text="{Binding Path=time_departure}" />
        </DataTemplate>
        <DataTemplate x:Key="cellLength">
            <TextBox Text="{Binding Path=length}" />
        </DataTemplate>
        <DataTemplate x:Key="cellLengthZ">
            <TextBox Text="{Binding Path=free_length}" />
        </DataTemplate>
        <DataTemplate x:Key="cellReis">
            <TextBox Text="{Binding Path=reis}" />
        </DataTemplate>
        <DataTemplate x:Key="cellColumn2">
            <TextBox Text="{Binding Path=column_2}"/>
        </DataTemplate>
        <DataTemplate x:Key="cellWorkTime">
            <TextBox Text="{Binding Path=work_time}"/>
        </DataTemplate>
        <DataTemplate x:Key="cellRestTime">
            <TextBox Text="{Binding Path=rest_time}"/>
        </DataTemplate>
    </UserControl.Resources>
    <Grid Height="541">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="34" />
            <RowDefinition Height="174*" />
            <RowDefinition Height="34" />
            <RowDefinition Height="110*" />
            <RowDefinition Height="70" />
        </Grid.RowDefinitions>
        <my:ucRouteInfo HorizontalAlignment="Left" x:Name="ucRouteInfo1" VerticalAlignment="Top" Height="179" Margin="0,12,0,0" Grid.RowSpan="1" />
        <StackPanel Grid.Row="1" Name="stackPanel1" Orientation="Horizontal">
            <Button Content="Добавить" Height="23" Name="buttonAddSchedule" Width="75" Click="buttonAddSchedule_Click" />
            <Button Content="Удалить" Height="23" Name="buttonDeleteSchedule" Width="75" Click="buttonDeleteSchedule_Click" />
            <Button Visibility="Hidden" Content="Редактировать" Height="23" Name="buttonEditSchedule" Width="103" Click="buttonEditSchedule_Click" />
        </StackPanel>
        <ListView Grid.Row="2" Name="listViewSchedule" Margin="0"  ItemsSource="{Binding Source={StaticResource sourceSchedule}}">
            <ListView.View>
                <GridView>
                    <!-- <GridViewColumn Header="Выкл." Width="30" CellTemplate="{StaticResource cellDel}"/> -->
                    <GridViewColumn Header="Маршрут" Width="100" CellTemplate="{StaticResource cellRoute}"/>
                    <GridViewColumn Header="Пункт" Width="200" CellTemplate="{StaticResource cellBusstop}"/>
                    <GridViewColumn Header="Приб." Width="60" CellTemplate="{StaticResource cellArrive}"/>
                    <GridViewColumn Header="Отпр." Width="60" CellTemplate="{StaticResource cellDeparture}"/>
                </GridView>
            </ListView.View>
        </ListView>
        <StackPanel Grid.Row="3" Name="stackPanel2" Orientation="Horizontal" >
            <Button Content="Добавить" Height="23" Name="buttonAddInfo" Width="75" Click="buttonAddInfo_Click" />
            <Button Content="Удалить" Height="23" Name="buttonDeleteInfo" Width="75" Click="buttonDeleteInfo_Click" />
            <Button Visibility="Hidden" Content="Редактировать" Height="23" Name="buttonEditInfo" Width="103" Click="buttonEditInfo_Click" />
        </StackPanel>
        <ListView Grid.Row="4" Name="listViewInfo" ItemsSource="{Binding Source={StaticResource sourceInfo}}">
            <ListView.View>
                <GridView>
                    <!-- <GridViewColumn Header="Выкл." Width="30" CellTemplate="{StaticResource cellDel}"/> -->
                    <GridViewColumn Header="Маршрут" Width="100" CellTemplate="{StaticResource cellRoute}"/>
                    <GridViewColumn Header="Пробег" Width="70" CellTemplate="{StaticResource cellLength}"/>
                    <GridViewColumn Header="Проб. нул." Width="70" CellTemplate="{StaticResource cellLengthZ}"/>
                    <GridViewColumn Header="Рейсы" Width="70" CellTemplate="{StaticResource cellReis}"/>
                    <GridViewColumn Header="План" Width="70" CellTemplate="{StaticResource cellColumn2}"/>
                    <GridViewColumn Header="Раб. (ч)." Width="70" CellTemplate="{StaticResource cellWorkTime}"/>
                    <GridViewColumn Header="Отдых(ч)" Width="70" CellTemplate="{StaticResource cellRestTime}"/>
                </GridView>
            </ListView.View>
        </ListView>
        <Grid Grid.Row="5" Name="gridplandays" >
        <Label Content="ПН" Height="28" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" Margin="6,0,0,0" />
        <Label Content="ВТ" Height="28" HorizontalAlignment="Left" Margin="90,0,0,0" Name="label2" VerticalAlignment="Top" />
        <Label Content="СР" Height="28" HorizontalAlignment="Left" Margin="171,0,0,0" Name="label3" VerticalAlignment="Top" />
        <Label Content="ЧТ" Height="28" HorizontalAlignment="Left" Margin="255,0,0,0" Name="label4" VerticalAlignment="Top" />
        <Label Content="ПТ" Height="28" HorizontalAlignment="Left" Margin="335,0,0,0" Name="label5" VerticalAlignment="Top" />
            <Label Content="СБ" Height="28" HorizontalAlignment="Left" Margin="411,0,0,0" Name="label6" VerticalAlignment="Top" />
            <Label Content="ВС" Height="28" HorizontalAlignment="Left" Margin="499,0,0,0" Name="label7" VerticalAlignment="Top" />
            <TextBox Height="23" HorizontalAlignment="Left" Margin="0,34,0,0" Name="textBoxMO" VerticalAlignment="Top" Width="61" Text="{Binding Path=monday, Mode=TwoWay}"/>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="75,34,0,0" Name="textBoxTU" VerticalAlignment="Top" Width="64" Text="{Binding Path=tuesday, Mode=TwoWay}"/>
            <TextBox Height="23" Margin="160,34,0,0" Name="textBoxWE" VerticalAlignment="Top" Text="{Binding Path=wednesday, Mode=TwoWay}" HorizontalAlignment="Left" Width="65" />
            <TextBox Height="23" HorizontalAlignment="Left" Margin="255,34,0,0" Name="textBoxTH" VerticalAlignment="Top" Width="54" Text="{Binding Path=thursday, Mode=TwoWay}"/>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="335,34,0,0" Name="textBoxFR" VerticalAlignment="Top" Width="59" Text="{Binding Path=friday, Mode=TwoWay}"/>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="411,34,0,0" Name="textBoxSA" VerticalAlignment="Top" Width="62" Text="{Binding Path=saturday, Mode=TwoWay}"/>
            <TextBox Height="23" HorizontalAlignment="Left" Margin="499,34,0,0" Name="textBox1" VerticalAlignment="Top" Width="68" Text="{Binding Path=sunday, Mode=TwoWay}"/>
        </Grid>
    </Grid>
</UserControl>
